import React, {useEffect} from 'react';
import {useLocation, useParams} from "react-router-dom";
import {getHospitalShowById} from "@/api/hosp";
import {useAppDispatch} from "@/hooks";
import {upItems} from "@/store/slices/common";

function Index() {
    const {id} = useParams();
    const dispatch = useAppDispatch();
    const {pathname} = useLocation();
    useEffect(()=>{
        getHospitalShowById(id as string).then(value=>{
            // console.log(value.data.hospital.hosname);
            dispatch(upItems({
                key:pathname,
                label:value.data.hospital.hosname+"详情"
            }))
        })
    },[])
    return (
        <div>医院详情:{id}</div>
    );
}

export default Index;